<!-- 快捷回复 -->

<template>
  <FormSlot
    v-if="!CORE.isEmpty(dict)"
    label="快捷回复"
    class="DetailRepair-QuickReply"
    :word5="one.method === 'suspend'"
    small
  >
    <el-tag v-for="item in dict" :key="item[0]" type="info" small @click="toClick(item)">{{ item[1] }}</el-tag>
  </FormSlot>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'QuickReply',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb('deal'), CORE.mixSelect('reply', 'reply_')],

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 字典
     */
    dict() {
      const { reply_selectDict: dict, one } = this
      return dict.filter(item => item[2] === `${one.method}_task`)
    },
  },

  /**
   * 本地方法 (轻量重要在前)
   */
  methods: {
    /**
     * 点击
     */
    toClick([, reply]) {
      this.one.opinion = reply
    },
  },
}
</script>

<style lang="scss">
@import './index.scss';
</style>
